<!DOCTYPE html>
<html>
<head>
  <title>AutokoolApp</title>
  <%= stylesheet_link_tag    "application", :media => "all" %>
  <%= javascript_include_tag "application" %>
  <%= csrf_meta_tags %>
</head>
<body class="<%= params[:controller] %>">
  <div id="container">
		<% unless @current_user.nil? %>	
			<div id="logout">
				<%= "You are logged in as " + @current_user.usable.full_name %> | 
				<%= link_to 'Log out', logout_path %>
			</div>
		<% end %>
    <% flash.each do |name, msg| %>
      <%= content_tag :div, msg, :id => "flash_#{name}" %>
    <% end %>
		<% unless @current_user.nil? %>	
			<div id="menu">
				<% if @current_user.student? %>
					<h1>Student portal</h1>
					<%= link_to 'Register timeslot', timeslots_search_path %> |
          <%= link_to 'View driving lessons', driving_lessons_student_path(@current_user.usable) %> |
          <%= link_to 'View cancel reports', cancellation_reports_student_path(@current_user.usable) %>
				<% else %>
					<h1>Instructor portal</h1>
					<%= link_to 'Add timeslot', new_timeslot_path %> | 
					<%= link_to 'View timeslots', timeslots_path %> |
           <%= link_to 'View driving lessons', driving_lessons_instructor_path(@current_user.usable) %> |
					<%= link_to 'View cancel reports', cancellation_reports_instructor_path(@current_user.usable) %>
				<% end %>
			</div>
			<hr/>
		<% end %>
    <%= yield %>
  </div>
</body>
</html>
